Temporal reasoning function rule examples

Temporal reasoning function rule examples

Temporal reasoning functions are used in rules to compute results for, and express relationships that involve, attributes over multiple periods.

Be sure to use the exact syntax for these functions including spacing and parentheses as specified below.

Rule examples

Function Example Further information
IntervalCountDistinct

the client's distinct address count = IntervalCountDistinct(2005-07-01,2006-07-01,the client's address)

Calculate the number of distinct values for a variable in a time period
IntervalCountDistinctIf

the client's distinct address count = IntervalCountDistinctIf(2000-01-01,2007-01-01,the client's address,the client is aged over 18)

Calculate the number of distinct values for a variable in a time period only when a condition is true
IntervalDailySum

the amount of benefit payable for the assessment period = IntervalDailySum(2006-07-05,2006-08-01,the daily rate of benefit)

Calculate the sum of a variable in a time period
IntervalDailySumIf

the total amount spent on weekends in December = IntervalDailySumIf(2006-12-01,2007-01-01,the daily amount spent,the day is a weekend)

Calculate the sum of a variable in a time period only when a condition is true
IntervalMaximum

the maximum rate of benefit during the assessment period = IntervalMaximum(2006-07-05,2006-08-01,the daily rate of benefit)

Find the maximum amount in a period
IntervalMaximumIf

the maximum rate of benefit payable during the assessment period = IntervalMaximumIf(2006-07-05,2006-08-01,the maximum daily rate of benefit,the client is eligible for the benefit)

Find the maximum amount in a period when a boolean attribute is true
IntervalMinimum

the minimum rate of benefit during the assessment period = IntervalMinimum(2006-07-05,2006-08-01,the daily rate of benefit)

Find the minimum amount in a period

IntervalMinimumIf

the minimum rate of benefit payable during the assessment period = IntervalMinimumIf(2006-07-05,2006-08-01,the minimum daily rate of benefit,the client is eligible for the benefit)

Find the minimum amount in a period when a boolean attribute is true
IntervalWeightedAverage

the average number of children in care = IntervalWeightedAverage(2007-01-22,2007-01-29,the number of children in care)

Calculate the average value of a variable in a time period
IntervalWeightedAverageIf

the average number of children in care for the weekdays in the assessment period = IntervalWeightedAverageIf(2007-01-22,2007-01-29,the number of children in care,the day is a weekday)

Calculate the average value of a variable in a time period when a condition is true
IntervalAlways

the client was in jail at all times during the assessment period if

IntervalAlways(2006-07-10,2006-07-21,the client was in jail)

Check if a condition is true at all times in the time period
IntervalAtLeastDays

the employee has been at work for at least 5 days during the assessment period if

IntervalAtLeastDays(2007-07-01,2007-07-08,5,the employee was working)

Check if a condition is true for at least the specified number of days in the time period
IntervalConsecutiveDays

the employee has been at work for at least 5 consecutive days during the assessment period if

IntervalConsecutiveDays(2007-07-01,2007-07-08,5,the employee was working)

Check if a condition is true for at least the specified number of consecutive days in the time period
IntervalSometimes

the client has been in Australia if

IntervalSometimes(2007-01-08,2007-01-23,the client was in Australia)

Check if a condition is ever true in the time period
ValueAt

the rate of benefit payable on the date of claim = ValueAt(the date of claim,the rate of benefit)

Determine a rule attribute on a given date
WhenLast

the date the customer's bank balance was last over $100 = WhenLast(the current date,the customer's bank balance > 100)

Find the closest date when an attribute was true
WhenNext

the date the customer's bank balance was over $100 for the first time in 2007= WhenNext(2007-01-01,the customer's bank balance > 100)

Find the closest date when an attribute was true
Latest

the amount of benefit paid to the applicant since 1/7/2007 = IntervalDailySum(2007-07-01,Latest(),the amount of the monthly payment)

Get a date value equivalent to the latest possible date
Earliest

the amount of benefit paid to the applicant up until 1/7/2007 = IntervalDailySum(Earliest(),2007-07-01,the amount of the monthly payment)

Get a date value equivalent to the earliest possible date
TemporalIsWeekday

the applicant receives money if

TemporalIsWeekday(2006-07-01,2006-07-15)

Calculate the weekdays in a given time period
TemporalOncePerMonth

the applicant receives an allowance if

TemporalOncePerMonth(2006-07-01,2006-08-31,15)

Calculate a specific day in a month for a given time period
TemporalDaysSince

the number of days since it has rained = TemporalDaysSince(the date of the most recent rainfall,the current date)

Calculate the number of days since a given date
TemporalWeeksSince

the number of weeks in the assessment period = TemporalWeeksSince(2007-03-12,2007-04-11)

Calculate the number of weeks since a given date
TemporalMonthsSince

the number of months the mobile phone contract has been in effect = TemporalMonthsSince(the start date of the mobile phone contract,the current date)

Calculate the number of months since a given date
TemporalYearsSince

the child's age = TemporalYearsSince(the child's date of birth,the child’s fifth birthday)

Calculate the number of years since a given date
TemporalAlwaysDays

the employee has been at work for the last 4 days if

TemporalAlwaysDays(4,the employee was working)

Check if a condition is true for all of a specified number of preceding days
TemporalConsecutiveDays

the customer's bank balance has exceeded $50 for at least 2 consecutive days in the last 5 days if

TemporalConsecutiveDays(2,5,the customer's bank balance exceeds $50)

Check if a condition is true for at least the specified number of consecutive preceding days
TemporalSometimesDays

the customer's bank balance has exceeded $100 in the last 4 days if

TemporalSometimesDays(4,the customer's bank balance exceeds $100)

Check if a condition is ever true within a specified number of preceding days
TemporalAfter

the July 2005 rate changes apply if

TemporalAfter(2005-06-30)

Check if a condition is true after a given date and false on and before

TemporalBefore

the pre-2007 Ministerial Determination is in force if

TemporalBefore(2007-01-01)

Check if a condition is true before a given date and false on and afterwards
TemporalOn

the New Millennium Promotion is available to customers if

TemporalOn(2000-01-01)

Check if a condition is true on a given date and false before and afterwards
TemporalOnOrAfter

the 2007 Ministerial Determination is in force if

TemporalOnOrAfter(2007-01-01)

Check if a condition is true on or after a given date and false before
TemporalOnOrBefore

the pre-Christmas price list applies if

TemporalOnOrBefore(2007-12-24)

Check if a condition is true on and before a given date and false afterwards
TemporalFromStartDate

the person's most recent employer = TemporalFromStartDate(the person's jobs, the job's start date, the job's employer)

Get a temporal attribute from entity instances with values from the start date
TemporalFromEndDate

the person's effective first aid certificate ID = TemporalFromEndDate(the person's first aid certificates, the first aid certificate's expiry date, the first aid certificate ID)

Get a temporal attribute from entity instances with values up until the end date
TemporalFromRange

the person's effective security clearance = TemporalFromRange(the person's security clearances, the security clearance's start date, the security clearance's expiry date, the security clearance)

Get a temporal attribute from entity instances with values from the start date until the end date

 

TIP: The localized syntax for these functions may be viewed: